
package com.shop.cloud.mall.admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shop.cloud.common.core.constant.CacheConstants;
import com.shop.cloud.mall.common.entity.ShopInfo;
import com.shop.cloud.mall.admin.mapper.ShopInfoMapper;
import com.shop.cloud.mall.admin.service.ShopInfoService;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.io.Serializable;

/**
 * 店铺表
 *
 * @author
 * @date 2020-05-15 13:35:18
 */
@Service
public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> implements ShopInfoService {

	@Override
	@Cacheable(value = CacheConstants.MALL_SHOP_INFO_CACHE, key = "#id")
	public ShopInfo getById(Serializable id) {
		return super.getById(id);
	}

	@Override
	@CacheEvict(value = CacheConstants.MALL_SHOP_INFO_CACHE, key = "#entity.id")
	public boolean updateById(ShopInfo entity) {
		return super.updateById(entity);
	}

	@Override
	@CacheEvict(value = CacheConstants.MALL_SHOP_INFO_CACHE, key = "#id")
	public boolean removeById(Serializable id) {
		return super.removeById(id);
	}

	@Override
	public IPage<ShopInfo> page1(IPage<ShopInfo> page, Wrapper<ShopInfo> queryWrapper) {
		return baseMapper.selectPage1(page,queryWrapper.getEntity());
	}

	@Override
	@CacheEvict(value = CacheConstants.MALL_SHOP_INFO_CACHE, allEntries = true)
	public void removeCache() {

	}

	@Override
	public int updateByDeposit() {
		return baseMapper.updateByDeposit();
	}
}
